local sk_invalidity = fk.CreateSkill {

  name = "sk_invalidity",

  tags = {  },

}

MarkEnum.SkInvalidity = "SkInvalidity"

sk_invalidity:addEffect("invalidity", {
  name = "sk_invalidity",
  global = true,
  invalidity_func = function(self, from, skill)
    ---@param object Card|Player
    ---@param markname string
    ---@param suffixes string[]
    ---@return boolean
    local function hasMark(object, markname, suffixes)
      if not object then return false end
      for mark, _ in pairs(object.mark) do
        if mark == markname then return true end
        if mark:startsWith(markname .. "-") then
          for _, suffix in ipairs(suffixes) do
            if mark:find(suffix, 1, true) then return true end
          end
        end
      end
      return false
    end
    return from:hasSkill(skill, true) and
      skill:isPlayerSkill(from) and skill.visible and
      hasMark(from, MarkEnum.SkInvalidity, MarkEnum.TempMarkSuffix)
  end
})

return sk_invalidity